package com.ruoyi.market.factory;

import com.ruoyi.common.utils.ApplicationContextUtil;
import com.ruoyi.market.enums.WarnEnum;
import com.ruoyi.market.service.IWarningService;
import com.ruoyi.market.service.warning.*;

import java.util.HashMap;
import java.util.Map;

public class WarnFactory {

    private static Map<String, Class<? extends IWarningService>> serviceMap = new HashMap<>();
    static {
//        serviceMap.put(WarnEnum.WOLIANSMS_MARKET.getValue(), WoLianSmsMarketWarningService.class);
//        serviceMap.put(WarnEnum.WOLIANSMS.getValue(), WoLianSmsWarningService.class);
        serviceMap.put(WarnEnum.ALI_ACCOUNT_BALANCE.getValue(), AliAccountBalanceWarningService.class);
//        serviceMap.put(WarnEnum.DAHANSMS.getValue(), DaHanSmsWarningService.class);

        serviceMap.put(WarnEnum.SMSVERIFY.getValue(), SmsNoticeBalanceServie.class);
        serviceMap.put(WarnEnum.SMSNOTICE.getValue(), SmsVerifyBalanceServie.class);
    }

    public static IWarningService getService(String type){
        if (serviceMap.containsKey(type)){
            Class<? extends IWarningService> aClass = serviceMap.get(type);
            return ApplicationContextUtil.getBean(aClass);
        }
        return null;
    }
}
